package com.hlhj.carview.module

import android.content.Context
import com.example.mymvp.mvp.BaseModule
import com.hlhj.carview.Iview.GetCashView
import com.hlhj.carview.bean.MyBaseBean
import com.hlhj.carview.http.Apis
import com.hlhj.carview.http.CustomAction
import com.hlhj.carview.http.LoadingAction
import com.lzy.okgo.model.Response

/**
 * Created by Never Fear   on 2019\1\11 0011.
Never More....
 */
class GetCashModule:BaseModule {
    var lis:GetCashView?=null

    fun getCash(account:String,type:Int,money:String,c:Context){
        Apis.getCash(account, type, money)
                ?.let {
                    it.doOnSubscribe(LoadingAction(c))
                            .subscribe(object :CustomAction<Response<MyBaseBean>>(c){
                                override fun httpSuccess(t: Response<MyBaseBean>) {
                                    lis?.setResult(t.body())
                                }
                            })
                }
    }
}